function [sow] = timetrans(year, monthnum,dayofmonth,hour, minute, second)
%   INPUTS
%         year          - year of BDT
%         monthnum      - monthnum of BDT
%         dayofmonth    - dayofmonth of BDT
%   OUTPUTS
%         week          - week of BDS Time
%         sow           - second of week of BDS Time
% -------------------------------------------------------------------------
doy = [0,31,59,90,120,151,181,212,243,273,304,334];
ye = year - 2006;
lpdays = floor((ye+2)/4);
if (rem(ye,4) == 0) && (monthnum <=2)
    lpdays = lpdays - 1;
end

% Compute the number of days elapsed since
de = ye*365 + doy(monthnum) + dayofmonth + lpdays-1;

sow = rem(de,7) * 86400 + hour * 3600 + minute*60 + second;


